<!DOCTYPE html>
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
  <style type="text/css">
    body, html,#allmap {width: 100%;height: 100%;overflow: hidden;margin:0;font-family:"微软雅黑";}
  </style>
  <script type="text/javascript" src="https://api.map.baidu.com/api?type=webgl&v=1.0&ak=8scLv7YneA5YNgLS5d9pqWlozOdUUEMy"></script>
  <title>批量转换</title>
</head>
<body>
<div id="allmap"></div>
</body>
</html>
<script type="text/javascript">

  var points = [new BMapGL.Point(121.569735,38.926334),
    new BMapGL.Point(121.568735,38.927334),
    new BMapGL.Point(121.577835,38.926334),
    new BMapGL.Point(121.56865,38.936334),
    new BMapGL.Point(121.578735,38.936534)
  ];

  //地图初始化
  var bm = new BMapGL.Map("allmap");
  bm.centerAndZoom(new BMapGL.Point(121.568735,38.926334), 15);

  //坐标转换完之后的回调函数
  translateCallback = function (data){
    if(data.status === 0) {
      for (var i = 0; i < data.points.length; i++) {
        bm.addOverlay(new BMapGL.Marker(data.points[i]));
        bm.setCenter(data.points[i]);
      }
    }
  }
  setTimeout(function(){
    var convertor = new BMapGL.Convertor();
    convertor.translate(points, COORDINATES_WGS84, COORDINATES_BD09, translateCallback)
  }, 1000);

  /**
   * 坐标常量说明：
   * COORDINATES_WGS84 = 1, WGS84坐标
   * COORDINATES_WGS84_MC = 2, WGS84的平面墨卡托坐标
   * COORDINATES_GCJ02 = 3，GCJ02坐标
   * COORDINATES_GCJ02_MC = 4, GCJ02的平面墨卡托坐标
   * COORDINATES_BD09 = 5, 百度bd09经纬度坐标
   * COORDINATES_BD09_MC = 6，百度bd09墨卡托坐标
   * COORDINATES_MAPBAR = 7，mapbar地图坐标
   * COORDINATES_51 = 8，51地图坐标
   */
</script>

